package com.sfx.concurrent.demo.concurrent.pattern.GuardedObjectEncapsulation;

import lombok.extern.slf4j.Slf4j;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2022-12-31
 * Time: 15:28
 */
//人来去取信
@Slf4j(topic = "c.People")
public class People extends Thread{
    private MailBoxes mailBoxes = new MailBoxes();
    @Override
    public void run() {
        log.debug("开始收信");
        GuardedObject guardedObject = mailBoxes.createGuardedObject();
        String mail = (String) guardedObject.get(3000);
        log.debug("邮箱id{} , 信息为{}",guardedObject.getId(),mail);
    }
}
